#ifndef _PREPROCESS_IL_SOURCE_H_
#define _PREPROCESS_IL_SOURCE_H_

static const CALchar * fft_ps_out_input_tomo_fft_source_ = "";


static const CALchar * fft_ps_gbuf_input_tomo_fft_source_ = 
"il_ps_2_0 \n"
"dcl_input_position_interp(linear_noperspective) v0.xy__ \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (1.793662034e-43f, 2.802596929e-45f, 1.821688004e-44f, 9.809089250e-45f, ) \n"
"dcl_literal l0, 0x00000080, 0x00000002, 0x0000000D, 0x00000007 \n"
"; l1 = (1.541428311e-44f, 0.0f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x0000000B, 0x00000000, 0x00000000, 0x00000000 \n"
"flr r0, v0.xy00 \n"
"ftoi r70, r0 \n"
"sample_resource(0)_sampler(0) r100, r0.xy00 \n"
"sample_resource(1)_sampler(0) r101, r0.xy00 \n"
"umod r10.x___, r70.x, l0.x \n"
"ishl r10.x___, r10.x, l0.y \n"
"ishl r20.x___, r70.y, l0.z \n"
"ushr r20._y__, r70.x, l0.w \n"
"ishl r20._y__, r20.y, l1.x \n"
"iadd r20.x___, r20.x, r20.y \n"
"iadd r10.x___, r10.x, r20.x \n"
"mov r300.x___, r100.x \n"
"mov r300.__z_, r101.x \n"
"mov g[r10.x+0], r300.x0z0 \n"
"mov r300.x___, r100.y \n"
"mov r300.__z_, r101.y \n"
"mov g[r10.x+1], r300.x0z0 \n"
"mov r300.x___, r100.z \n"
"mov r300.__z_, r101.z \n"
"mov g[r10.x+2], r300.x0z0 \n"
"mov r300.x___, r100.w \n"
"mov r300.__z_, r101.w \n"
"mov g[r10.x+3], r300.x0z0 \n"
"end \n";



static const CALchar * fft_cs_input_tomo_fft_source_ = 
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (2.802596929e-45f, 5.605193857e-45f, 9.809089250e-45f, 64.0f, ) \n"
"dcl_literal l0, 0x00000002, 0x00000004, 0x00000007, 0x42800000 \n"
"; l1 = (1.121038771e-44f, 1.541428311e-44f, 5.605193857e-45f, 0.0f, ) \n"
"dcl_literal l1, 0x00000008, 0x0000000B, 0x00000004, 0x00000000 \n"
"umod r10.x___, vThreadGrpIdFlat0.x, l0.y \n"
"ishl r10.x___, r10.x, l0.z \n"
"iadd r10.x___, vTidInGrpFlat0.x, r10.x \n"
"ushr r10._y__, vThreadGrpIdFlat0.x, l0.x \n"
"ishl r80.x___, vThreadGrpIdFlat0.x, l1.y \n"
"imad r80.x___, vTidInGrpFlat0.x, l1.z, r80.x \n"
"itof r10, r10 \n"
"sample_resource(0)_sampler(0) r100, r10.xy00 \n"
"sample_resource(1)_sampler(0) r101, r10.xy00 \n"
"mov r300.x___, r100.x \n"
"mov r300.__z_, r101.x \n"
"mov g[r80.x+0], r300.x0z0 \n"
"mov r300.x___, r100.y \n"
"mov r300.__z_, r101.y \n"
"mov g[r80.x+1], r300.x0z0 \n"
"mov r300.x___, r100.z \n"
"mov r300.__z_, r101.z \n"
"mov g[r80.x+2], r300.x0z0 \n"
"mov r300.x___, r100.w \n"
"mov r300.__z_, r101.w \n"
"mov g[r80.x+3], r300.x0z0 \n"
"add r10.x___, r10.x, l0.w \n"
"sample_resource(0)_sampler(0) r200, r10.xy00 \n"
"sample_resource(1)_sampler(0) r201, r10.xy00 \n"
"mov r300.x___, r200.x \n"
"mov r300.__z_, r201.x \n"
"mov g[r80.x+256], r300.x0z0 \n"
"mov r300.x___, r200.y \n"
"mov r300.__z_, r201.y \n"
"mov g[r80.x+257], r300.x0z0 \n"
"mov r300.x___, r200.z \n"
"mov r300.__z_, r201.z \n"
"mov g[r80.x+258], r300.x0z0 \n"
"mov r300.x___, r200.w \n"
"mov r300.__z_, r201.w \n"
"mov g[r80.x+259], r300.x0z0 \n"
"mov g[r80.x+512], r300.0000 \n"
"mov g[r80.x+513], r300.0000 \n"
"mov g[r80.x+514], r300.0000 \n"
"mov g[r80.x+515], r300.0000 \n"
"mov g[r80.x+768], r300.0000 \n"
"mov g[r80.x+769], r300.0000 \n"
"mov g[r80.x+770], r300.0000 \n"
"mov g[r80.x+771], r300.0000 \n"
"mov g[r80.x+1024], r300.0000 \n"
"mov g[r80.x+1025], r300.0000 \n"
"mov g[r80.x+1026], r300.0000 \n"
"mov g[r80.x+1027], r300.0000 \n"
"mov g[r80.x+1280], r300.0000 \n"
"mov g[r80.x+1281], r300.0000 \n"
"mov g[r80.x+1282], r300.0000 \n"
"mov g[r80.x+1283], r300.0000 \n"
"mov g[r80.x+1536], r300.0000 \n"
"mov g[r80.x+1537], r300.0000 \n"
"mov g[r80.x+1538], r300.0000 \n"
"mov g[r80.x+1539], r300.0000 \n"
"mov g[r80.x+1792], r300.0000 \n"
"mov g[r80.x+1793], r300.0000 \n"
"mov g[r80.x+1794], r300.0000 \n"
"mov g[r80.x+1795], r300.0000 \n"
"end \n";



static const CALchar * _fftexpand_512_to_2048_tomo_fft_source_=
"il_cs_2_0 \n"
"dcl_cb cb0[1] \n"
"dcl_num_thread_per_group 64 \n"
"; l0 = (128.0f, 1.401298464e-45f, 0.0f, 0.0f, ) \n"
"dcl_literal l0, 0x43000000, 0x00000001, 0x00000000, 0x00000000 \n"
"ishr r0._y__, vAbsTidFlat0.x, cb0[0].x \n"
"umod r0.x___, vAbsTidFlat0.x, cb0[0].y \n"
"itof r0, r0 \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(2)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(3)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"sample_resource(0)_sampler(0) r100, r0.xy00 \n"
"sample_resource(1)_sampler(0) r110, r0.xy00 \n"
"sample_resource(2)_sampler(0) r120, r0.xy00 \n"
"sample_resource(3)_sampler(0) r130, r0.xy00 \n"
"ftoi r200, r0 \n"
"ishl r200.x___, r200.x, cb0[0].z \n"
"imad r200.__z_, r200.y, cb0[0].w, r200.x \n"
"add r0.x___, r0.x, l0.x \n"
"sample_resource(0)_sampler(0) r101, r0.xy00 \n"
"sample_resource(1)_sampler(0) r111, r0.xy00 \n"
"sample_resource(2)_sampler(0) r121, r0.xy00 \n"
"sample_resource(3)_sampler(0) r131, r0.xy00 \n"
"mov g[r200.z+0].x___, r100.x \n"
"mov g[r200.z+0].__z_, r101.x \n"
"mov g[r200.z+1].x___, r100.y \n"
"mov g[r200.z+1].__z_, r101.y \n"
"mov g[r200.z+2].x___, r100.z \n"
"mov g[r200.z+2].__z_, r101.z \n"
"mov g[r200.z+3].x___, r100.w \n"
"mov g[r200.z+3].__z_, r101.w \n"
"imad r200.__z_, cb0[0].y, cb0[0].w, r200.z \n"
"mov g[r200.z+0].x___, r110.x \n"
"mov g[r200.z+0].__z_, r111.x \n"
"mov g[r200.z+1].x___, r110.y \n"
"mov g[r200.z+1].__z_, r111.y \n"
"mov g[r200.z+2].x___, r110.z \n"
"mov g[r200.z+2].__z_, r111.z \n"
"mov g[r200.z+3].x___, r110.w \n"
"mov g[r200.z+3].__z_, r111.w \n"
"imad r200.__z_, cb0[0].y, cb0[0].w, r200.z \n"
"mov g[r200.z+0].x___, r120.x \n"
"mov g[r200.z+0].__z_, r121.x \n"
"mov g[r200.z+1].x___, r120.y \n"
"mov g[r200.z+1].__z_, r121.y \n"
"mov g[r200.z+2].x___, r120.z \n"
"mov g[r200.z+2].__z_, r121.z \n"
"mov g[r200.z+3].x___, r120.w \n"
"mov g[r200.z+3].__z_, r121.w \n"
"imad r200.__z_, cb0[0].y, cb0[0].w, r200.z \n"
"mov g[r200.z+0].x___, r130.x \n"
"mov g[r200.z+0].__z_, r131.x \n"
"mov g[r200.z+1].x___, r130.y \n"
"mov g[r200.z+1].__z_, r131.y \n"
"mov g[r200.z+2].x___, r130.z \n"
"mov g[r200.z+2].__z_, r131.z \n"
"mov g[r200.z+3].x___, r130.w \n"
"mov g[r200.z+3].__z_, r131.w \n"
"endmain \n"
"end \n";

static const CALchar * _output_2048_512_tomo_fft_source_=
"il_ps_2_0 \n"
"dcl_input_position_interp(linear_noperspective) v0.xy__ \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_output_generic o0 \n"
"dcl_output_generic o1 \n"
"; l0 = (1.261168618e-44f, 7.174648137e-43f, -1.#QNANf, 7.160635153e-43f, ) \n"
"dcl_literal l0, 0x00000009, 0x00000200, 0xFFFFFE00, 0x000001FF \n"
"; l1 = (2.802596929e-45f, 1.541428311e-44f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x0000000B, 0x00000000, 0x00000000 \n"
"ftoi r0, v0 \n"
"and r1.x___, r0.x, l0.z \n"
"ishl r1.x___, r1.x, l1.x \n"
"and r1._y__, r0.x, l0.w \n"
"itof r1, r1 \n"
"itof r0, r0 \n"
"add r0.x___, r1.x, r1.y \n"
"sample_resource(0)_sampler(0) r100, r0.xy00 \n"
"mov o0.x___, r100.x \n"
"mov o1.x___, r100.z \n"
"endmain \n"
"end \n";

static const CALchar * _fft_input_cs_transXY_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0] - width, height, padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"dcl_resource_id(1)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (1.401298464e-45f, 2.869859255e-42f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000001, 0x00000800, 0x00000000, 0x00000000 \n"
"mov r70.x___, vAbsTidFlat0.x \n"
"ishr r10.x___, cb0[0].x, l0.y \n"
"umod r80.x___, r70.x, r10.x \n"
"udiv r80._y__, r70.x, r10.x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0) r100, r81.xy00 \n"
"sample_resource(1)_sampler(1) r110, r81.xy00 \n"
"mov r200.xy__, r100.xyxy \n"
"mov r200.__zw, r110.xyxy \n"
"mov r201.xy__, r100.zwzw \n"
"mov r201.__zw, r110.zwzw \n"
"ishl r71.x___, r70.x, l0.y \n"
"mov r90.x___, r71.x \n"
"call 10 \n"
"mov r81.x___, r90.x \n"
"mov g[r81.x+0], r200 \n"
"iadd r90.x___, r71.x, l0.y \n"
"call 10 \n"
"mov r82.x___, r90.x \n"
"mov g[r82.x+0], r201 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod D \n"
"; X = (pos/D) mod W \n"
"; Y = (pos/D)/W mod H \n"
"; TileID = (pos/D)/W/H \n"
"; pos' = ((X+TileID*W)*H+Y)*D+Z \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r91.___w, r90.z, cb0[1].y \n"
"ishl r90.x___, r91.w, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ret \n"
"endfunc \n"
"end \n";

static const CALchar * _fft_output_cs_transXY_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0].xy - width height \n"
"; cb0[0].z  - padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (2.802596929e-45f, 5.605193857e-45f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x00000004, 0x00000000, 0x00000000 \n"
"mov r71.x___, vAbsTidFlat0.x \n"
"ishl r70.x___, r71.x, l0.y \n"
"mov r90.x___, r70.x \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r200, r81.xy00 \n"
"iadd r90.x___, r70.x, l0.y \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r201, r81.xy00 \n"
"mov r100.xy__, r200.xyxy \n"
"mov r110.xy__, r200.zwzw \n"
"mov r100.__zw, r201.xyxy \n"
"mov r110.__zw, r201.zwzw \n"
"mov g[r71.x+0], r100 \n"
"iadd r72.x___, r71.x, cb0[0].z \n"
"mov g[r72.x+0], r110 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod D \n"
"; X = (pos/D) mod W \n"
"; Y = (pos/D)/W mod H \n"
"; TileID = (pos/D)/W/H \n"
"; pos' = ((X+TileID*W)*H+Y)*D+Z \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r91.___w, r90.z, cb0[1].y \n"
"ishl r90.x___, r91.w, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ret \n"
"endfunc \n"
"end \n";

static const CALchar * _fft_output_cs_trans5D_source_=
"il_cs_2_0 \n"
"dcl_num_thread_per_group 64 \n"
"dcl_cb cb0[3] \n"
"; cb0[0].xy - width height \n"
"; cb0[0].z  - padedSize/2 \n"
"; cb0[1] - 3D transpose W,H,D (2's power) \n"
"; cb0[2] - 3D transpose W,H,D (and mask) \n"
"dcl_resource_id(0)_type(2d,unnorm)_fmtx(float)_fmty(float)_fmtz(float)_fmtw(float) \n"
"; l0 = (0.0f, 1.401298464e-45f, -1.#QNANf, 4.203895393e-45f, ) \n"
"dcl_literal l0, 0x00000000, 0x00000001, 0xFFFFFFFF, 0x00000003 \n"
"; l1 = (2.802596929e-45f, 5.605193857e-45f, 0.0f, 0.0f, ) \n"
"dcl_literal l1, 0x00000002, 0x00000004, 0x00000000, 0x00000000 \n"
"mov r71.x___, vAbsTidFlat0.x \n"
"ishl r70.x___, r71.x, l0.y \n"
"mov r90.x___, r70.x \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r200, r81.xy00 \n"
"iadd r90.x___, r70.x, l0.y \n"
"call 10 \n"
"umod r80.x___, r90.x, cb0[0].x \n"
"udiv r80._y__, r90.x, cb0[0].x \n"
"itof r81.xy__, r80.xyyy \n"
"sample_resource(0)_sampler(0)_aoffimmi(0.0,0.0,0.0) r201, r81.xy00 \n"
"mov r100.xy__, r200.xyxy \n"
"mov r110.xy__, r200.zwzw \n"
"mov r100.__zw, r201.xyxy \n"
"mov r110.__zw, r201.zwzw \n"
"mov g[r71.x+0], r100 \n"
"iadd r72.x___, r71.x, cb0[0].z \n"
"mov g[r72.x+0], r110 \n"
"endmain \n"
"func 10 \n"
"; Z = pos mod d \n"
"; X = (pos/D) mod w \n"
"; Y = (pos/D)/W mod h \n"
"; W = (pos/D)/W/H mod b \n"
"; TileID = (pos/d)/w/b \n"
"; pos' = (((Y+TileID*h)*d+Z)*b+W)*w+X \n"
"and r91.__z_, r90.x, cb0[2].z \n"
"ishr r90._y__, r90.x, cb0[1].z \n"
"and r91.x___, r90.y, cb0[2].x \n"
"ishr r90.__z_, r90.y, cb0[1].x \n"
"and r91._y__, r90.z, cb0[2].y \n"
"ishr r90.___w, r90.z, cb0[1].y \n"
"and r91.___w, r90.w, cb0[2].w \n"
"ishr r92.x___, r90.w, cb0[1].w \n"
"ishl r90.x___, r92.x, cb0[1].x \n"
"iadd r90.x___, r90.x, r91.x \n"
"ishl r90.x___, r90.x, cb0[1].w \n"
"iadd r90.x___, r90.x, r91.w \n"
"ishl r90.x___, r90.x, cb0[1].z \n"
"iadd r90.x___, r90.x, r91.z \n"
"ishl r90.x___, r90.x, cb0[1].y \n"
"iadd r90.x___, r90.x, r91.y \n"
"ret \n"
"endfunc \n"
"end \n";

#endif // _PREPROCESS_IL_SOURCE_H_